package com.intelligencesoft.pss.sina.weibo.weibo4j.model;

import com.intelligencesoft.pss.sina.weibo.weibo4j.http.Response;
import com.intelligencesoft.pss.sina.weibo.weibo4j.org.json.JSONException;
import com.intelligencesoft.pss.sina.weibo.weibo4j.org.json.JSONObject;

public class Result extends WeiboResponse{
	
	 /**
	 * @author 黄莹璐
	 * @date: 2014-9-9-下午5:36:15
	 * //TODO  黄莹璐编辑
	 */
	private static final long serialVersionUID = 6463372585869777452L;
	private String result;
	private String error;
	private String errorCode;
	private String errorDescription;
	
	public Result(Response res) throws WeiboException{
		super(res);
		JSONObject json =res.asJSONObject();
		try{
			result = json.getString("result");
			error = json.getString("error");
			errorCode = json.getString("error_code");
			errorDescription = json.getString("error_description");
		} catch (JSONException je) {
			throw new WeiboException(je.getMessage() + ":" + json.toString(), je);
		}
	}
	
	public Result(String result,String error,String errorCode,String errorDescription){
		this.result = result;
		this.error = error;
		this.errorCode = errorCode;
		this.errorDescription = errorDescription;
	}

	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}

	public String getError() {
		return error;
	}

	public void setError(String error) {
		this.error = error;
	}

	public String getErrorCode() {
		return errorCode;
	}

	public void setErrorCode(String errorCode) {
		this.errorCode = errorCode;
	}

	public String getErrorDescription() {
		return errorDescription;
	}

	public void setErrorDescription(String errorDescription) {
		this.errorDescription = errorDescription;
	}
}
